package com.kaibes.module.security.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.kaibes.module.security.entity.Authority;
import com.kaibes.web.api.ResponseServiceImpl;

@Service
public class AuthorityService extends ResponseServiceImpl<Authority> {
	
	public boolean hasName(String name) {
	    return count(query().eq("name", name).build()) == 1;
	}
	
	public boolean notName(String name) {
	    return count(query().eq("name", name).build()) < 1;
	}
	
	public List<Authority> listByRoleId(Integer roleId) {
		return list(query().eq("role_id", roleId).build());
	}
	
}
